package com.cn.qgx428.orderingmeal.adapter;

import android.content.Context;
import android.widget.TextView;

import com.cn.qgx428.orderingmeal.R;
import com.cn.qgx428.orderingmeal.myClass.OrderDetailInfo;
import com.cn.qgx428.orderingmeal.viewHolder.RViewHolder;

import java.util.List;

/**
 * Created by QinX on 2017/5/23.
 */

public class OrderDetailAdapter extends RBaseAdapter {

    public OrderDetailAdapter(Context context, List list, int itemLayoutId) {
        super(context, list, itemLayoutId);
    }

    @Override
    public void convert(RViewHolder holder, Object item) {

        OrderDetailInfo info = (OrderDetailInfo) item ;

        TextView name = holder.getView(R.id.orderDetail_item_name);
        TextView amount = holder.getView(R.id.orderDetail_item_amount);
        TextView total = holder.getView(R.id.orderDetail_item_total);

        name.setText(info.getFoodName());
        amount.setText(String.valueOf((int)(Double.valueOf(info.getFoodTotalPrice())/info.getFoodPrice())));
        total.setText("￥ "+info.getFoodTotalPrice());
    }
}
